<template>
  <div class="linkage">
    <div>
      <el-select v-model="item.directions"
                 default-first-option
                 filterable
                 multiple
                 value-key="directionId"
                 style="width:600px"
                 placeholder="请选择精专方向">
<!--        <el-option label="请选择精专方向" value=""></el-option>-->
        <el-option v-for="item in directionList" :key="item.directionId" :label="item.directionName" :value="item"></el-option>
      </el-select>
    </div>
  </div>
</template>

<script>
export default {
  name: "DirectionSelector",
  props: ['item'],
  data() {
    return {
      directionList:[],
    }
  },
  created() {
    let url = '';
    if (this.item.expertId){
      url = 'api/expertDirection/list';
    } else if (this.item.teamId){
      url = 'api/teamDirection/list';
    }
    this.$http.get(url).then(res =>{
      if (res.data.code===200){
        this.directionList = res.data.data;
        // console.log('this.directionList',this.directionList)
      }
    })
  }
}
</script>

<style scoped>
.linkage {
  display: flex;
}

.linkage div {
  margin-right: 5px;
}
</style>